Technical details
library(GeoPressureR)
library(leaflet)
library(leaflet.extras)
library(raster)
library(dplyr)
library(ggplot2)
library(kableExtra)
library(plotly)
library(GeoLocTools)
setupGeolocation()
knitr::opts_chunk$set(echo = FALSE)
load(paste0("../data/1_pressure/", params$gdl_id, "_pressure_prob.Rdata"))
load(paste0("../data/2_light/", params$gdl_id, "_light_prob.Rdata"))
load(paste0("../data/3_static/", params$gdl_id, "_static_prob.Rdata"))
load(paste0("../data/4_basic_graph/", params$gdl_id, "_basic_graph.Rdata"))
load(paste0("../data/5_wind_graph/", params$gdl_id, "_wind_graph.Rdata"))
col <- rep(RColorBrewer::brewer.pal(8, "Dark2"), times = ceiling(max(pam$sta$sta_id) / 8))
All the results produced here are generated with (1) the raw geolocator data, (2) the labeled files of pressure and light and (3) the parameters listed below.
kable(gpr) %>% scroll_box(width = "100%")
| gdl_id | keep | crop_start | crop_end | thr_dur | extent_N | extent_W | extent_S | extent_E | map_scale | map_max_sample | map_margin | prob_map_s | prob_map_s_calib | prob_map_thr | shift_k | kernel_adjust | calib_lon | calib_lat | calib_1_start | calib_1_end | calib_2_start | calib_2_end | calib_2_lon | calib_2_lat | prob_light_w | thr_prob_percentile | thr_gs | thr_as | RingNo | scientific_name | common_name | mass | wing_span | Color | sta_id_winter |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 24EA | 1 | 2019-07-20 | 2019-10-31 05:45:00 | 0 | 51 | -18 | 5 | 16 | 4 | 300 | 30 | 1 | 1.3 | 0.9 | 0 | 1.4 | 6.96333 | 44.95177 | 2019-07-20 | 2019-09-16 | NA | NA | NA | NA | 0.09 | 0.95 | 120 | 100 | LW59569 | Oenanthe oenanthe | Northern wheatear | NA | NA | #AB63FA | NA |
The labeling of pressure data is illustrated with this figure. The black dots indicates the pressure datapoint not considered in the matching. Each stationary period is illustrated by a different colored line.
pressure_na <- pam$pressure %>%
mutate(obs = ifelse(isoutlier | sta_id == 0, NA, obs))
p <- ggplot() +
geom_line(data = pam$pressure, aes(x = date, y = obs), colour = "grey") +
# geom_point(data = subset(pam$pressure, isoutlier), aes(x = date, y = obs), colour = "black") +
# geom_line(data = pressure_na, aes(x = date, y = obs, color = factor(sta_id)), size = 0.5) +
geom_line(data = do.call("rbind", shortest_path_timeserie) %>% filter(sta_id > 0), aes(x = date, y = pressure0, col = factor(sta_id))) +
theme_bw() +
scale_colour_manual(values = col) +
scale_y_continuous(name = "Pressure(hPa)")
ggplotly(p, dynamicTicks = T) %>% layout(showlegend = F)
pressure_ts_bind <- do.call("rbind", shortest_path_timeserie) %>%
filter(!is.na(sta_id))
pam$pressure %>%
left_join(pressure_ts_bind %>% dplyr::select(c("date", "pressure0")), by = "date") %>%
mutate(diff = ifelse(is.na(pressure0), 0, obs - pressure0)) %>%
filter(sta_id > 0 & !isoutlier) %>%
group_by(sta_id) %>%
mutate(sta_id = paste0(sta_id, " (SD=", round(sd(diff), 2), " ; N=", n(), ")")) %>%
ggplot(aes(x = diff)) +
geom_histogram(aes(y = (..count..) / tapply(..count.., ..PANEL.., sum)[..PANEL..]), binwidth = .2) +
facet_wrap(~sta_id) +
scale_x_continuous(name = "Pressure Geolocator - best match ERA5 (hPa)") +
scale_y_continuous(name = "Normalized histogram")
raw_geolight <- pam$light %>%
transmute(
Date = date,
Light = obs
)
lightImage(tagdata = raw_geolight, offset = 0)
tsimagePoints(twl$twilight,
offset = 0, pch = 16, cex = 1.2,
col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
abline(v = gpr$calib_2_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_2_end, lty = 2, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_end, lty = 2, col = "firebrick", lwd = 1.5)
The probability map resulting from light data alone can be seen below.
li_s <- list()
l <- leaflet(width = "100%") %>%
addProviderTiles(providers$Stamen.TerrainBackground) %>%
addFullscreenControl()
for (i_r in seq_len(length(light_prob))) {
i_s <- metadata(light_prob[[i_r]])$sta_id
info <- pam$sta[pam$sta$sta_id == i_s, ]
info_str <- paste0(i_s, " | ", info$start, "->", info$end)
li_s <- append(li_s, info_str)
l <- l %>% addRasterImage(light_prob[[i_r]], opacity = 0.8, colors = "OrRd", group = info_str)
}
l %>%
addCircles(lng = gpr$calib_lon, lat = gpr$calib_lat, color = "black", opacity = 1) %>%
addLayersControl(
overlayGroups = li_s,
options = layersControlOptions(collapsed = FALSE)
) %>%
hideGroup(tail(li_s, length(li_s) - 1))
We can compare light and pressure location at long stationary stopover (>5 days). By assuming the best match of the pressure to be the truth, we can plot the histogram of the zenith angle and compare to the fit of kernel density at the calibration site.
raw_geolight <- pam$light %>%
transmute(
Date = date,
Light = obs
)
dur <- unlist(lapply(pressure_prob, function(x) difftime(metadata(x)$temporal_extent[2],metadata(x)$temporal_extent[1], units = "days" )))
long_id <- which(dur>5)
par(mfrow = c(2, 3))
for (i_s in long_id){
twl_fl <- twl %>%
filter(!deleted) %>%
filter(twilight>shortest_path_timeserie[[i_s]]$date[1] & twilight<tail(shortest_path_timeserie[[i_s]]$date,1))
sun <- solar(twl_fl$twilight)
z_i <- refracted(zenith(sun, shortest_path_timeserie[[i_s]]$lon[1], shortest_path_timeserie[[i_s]]$lat[1]))
hist(z_i, freq = F, main = paste0("sta_id=",i_s, " | ",nrow(twl_fl),"twls"))
lines(fit_z, col = "red")
xlab("Zenith angle")
}
Similarly, we can plot the line of sunrise/sunset at the best match of pressure (yellow line) and compare to the raw and labeled light data.
lightImage(
tagdata = raw_geolight,
offset = gpr$shift_k / 60 / 60
)
tsimagePoints(twl$twilight,
offset = gpr$shift_k / 60 / 60, pch = 16, cex = 1.2,
col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
for (ts in shortest_path_timeserie){
twl_fl <- twl %>%
filter(twilight>ts$date[1] & twilight<tail(ts$date,1))
if (nrow(twl_fl)>0){
tsimageDeploymentLines(twl_fl$twilight,
lon = ts$lon[1], ts$lat[1],
offset = gpr$shift_k / 60 / 60, lwd = 3,col = adjustcolor("orange", alpha.f = 0.5))
}
}
| …1 | sta_id_s | sta_id_t | flight_duration | as_m | as_s | gs_m | gs_s | ws_m | ws_s | dist_m | dist_s | ws_m_support | ws_m_drift | start_flight | end_flight | sunrise | sunset | as_sp | gs_sp | ws_sp | dist_sp | ws_sp_support | ws_sp_drift | alt_min | alt_max | alt_mean | alt_med | alt_sumdabsdiff | alt_sumposdiff | gdl_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2 | 6.5 | 40.85163 | 19.32891 | 40.02772 | 20.00647 | 5.109686 | 0.8018363 | 260.18018 | 130.04204 | -0.5062576 | 5.084545 | 2019-09-15 18:00:00 | 2019-09-16 00:30:00 | 2019-09-16 04:49:07 | 2019-09-15 18:13:34 | 35.34347 | 33.65606 | 5.121217 | 218.76440 | -1.3400815 | 4.9427766 | 37.049643 | 3339.6057 | 2248.8738 | 2610.0430 | 7850.436 | 2612.6042 | 24EA |
| 2 | 2 | 3 | 5.5 | 80.52282 | 16.28088 | 79.91931 | 15.95173 | 8.001190 | 2.1679086 | 439.55623 | 87.73453 | -0.2052617 | 7.998557 | 2019-09-16 18:00:00 | 2019-09-16 23:30:00 | 2019-09-17 05:03:14 | 2019-09-16 18:15:01 | 85.95793 | 84.75540 | 6.072656 | 466.15473 | -0.9935061 | 5.9908343 | -3.506296 | 2374.5672 | 1284.8146 | 1763.1219 | 4744.191 | 2366.1171 | 24EA |
| 3 | 3 | 4 | 4.5 | 75.91882 | 14.65826 | 71.79817 | 15.83220 | 10.930215 | 2.1379135 | 323.09178 | 71.24492 | -3.4069095 | 10.385691 | 2019-09-17 04:00:00 | 2019-09-17 08:30:00 | 2019-09-17 05:01:58 | 2019-09-16 18:21:57 | 65.14055 | 63.37325 | 12.541117 | 285.17962 | -0.5510405 | 12.5290047 | -30.158310 | 2134.7383 | 921.2303 | 904.1934 | 4328.087 | 2164.8966 | 24EA |
| 4 | 4 | 5 | 2.0 | 53.76916 | 15.80070 | 44.74897 | 14.81924 | 17.503973 | 2.0570275 | 89.49795 | 29.63848 | -6.5058792 | 16.250003 | 2019-09-17 21:30:00 | 2019-09-17 23:30:00 | 2019-09-18 05:02:15 | 2019-09-17 18:15:37 | 53.88986 | 43.09364 | 15.053161 | 86.18727 | -9.5194840 | 11.6609207 | -34.741219 | 1739.8438 | 513.6896 | 307.8903 | 3543.787 | 1943.2090 | 24EA |
| 5 | 5 | 6 | 2.0 | 37.50359 | 18.28044 | 35.57574 | 16.34625 | 5.911572 | 4.1957496 | 71.15149 | 32.69250 | -1.4889248 | 5.720995 | 2019-09-19 20:30:00 | 2019-09-19 22:30:00 | 2019-09-20 05:04:05 | 2019-09-19 18:11:08 | 36.69691 | 27.73917 | 8.958584 | 55.47834 | -8.9574713 | 0.1411681 | 599.590544 | 1688.8900 | 1010.7673 | 971.0152 | 1574.232 | 484.9328 | 24EA |
| 6 | 6 | 7 | 7.0 | 31.20499 | 14.76192 | 25.13120 | 13.59390 | 9.987888 | 2.2411343 | 175.91841 | 95.15733 | -4.8230153 | 8.746224 | 2019-10-16 17:30:00 | 2019-10-17 00:30:00 | 2019-10-17 05:25:38 | 2019-10-16 17:32:59 | 31.08194 | 23.99566 | 7.415674 | 167.96964 | -6.9867435 | 2.4854844 | 610.661026 | 2253.9275 | 1386.3409 | 1134.8906 | 3779.367 | 1952.0829 | 24EA |
| 7 | 7 | 8 | 12.0 | 46.81537 | 16.11553 | 57.78886 | 16.54388 | 12.785692 | 3.9419526 | 693.46633 | 198.52657 | 11.3460242 | 5.894206 | 2019-10-18 17:30:00 | 2019-10-19 05:30:00 | 2019-10-19 05:30:46 | 2019-10-18 17:32:28 | 36.37411 | 50.44613 | 16.495161 | 605.35356 | 14.8061553 | 7.2710449 | 444.009498 | 3662.1946 | 2508.2101 | 2552.5553 | 7560.170 | 3615.7391 | 24EA |
| 8 | 8 | 9 | 12.5 | 46.48865 | 14.54336 | 61.66574 | 15.41129 | 20.778989 | 3.7514450 | 770.82175 | 192.64109 | 16.8102682 | 12.213979 | 2019-10-19 17:30:00 | 2019-10-20 06:00:00 | 2019-10-20 05:36:33 | 2019-10-19 17:41:49 | 37.43866 | 54.05081 | 20.815042 | 675.63507 | 18.0672784 | 10.3363152 | 349.232911 | 1769.3532 | 848.2016 | 602.4171 | 5961.060 | 2947.7429 | 24EA |
| 9 | 9 | 10 | 12.0 | 46.26614 | 18.27973 | 32.11570 | 18.11870 | 17.091385 | 3.8216336 | 385.38840 | 217.42439 | -12.7199850 | 11.415665 | 2019-10-20 18:00:00 | 2019-10-21 06:00:00 | 2019-10-21 05:31:26 | 2019-10-20 17:53:45 | 34.06623 | 22.47428 | 14.994938 | 269.69131 | -9.5791074 | 11.5364147 | 352.037669 | 2892.6612 | 1588.1801 | 1771.9389 | 12092.732 | 6046.6389 | 24EA |
| 10 | 10 | 11 | 7.0 | 32.50895 | 16.11860 | 30.32467 | 15.74315 | 11.541404 | 4.8618572 | 212.27268 | 110.20205 | -0.0666471 | 11.541211 | 2019-10-21 18:00:00 | 2019-10-22 01:00:00 | 2019-10-22 05:31:23 | 2019-10-21 17:50:34 | 31.44794 | 31.84974 | 4.588861 | 222.94815 | 0.7298400 | 4.5304502 | 330.636939 | 2621.9298 | 1180.7573 | 881.9445 | 9767.523 | 4867.6144 | 24EA |
| 11 | 11 | 12 | 5.0 | 30.03292 | 15.91888 | 32.05092 | 15.39850 | 19.580955 | 8.0142048 | 160.25462 | 76.99248 | 7.9358001 | 17.900751 | 2019-10-22 18:30:00 | 2019-10-22 23:30:00 | 2019-10-23 05:33:58 | 2019-10-22 17:52:20 | 31.37587 | 27.22712 | 24.452969 | 136.13560 | 6.5159039 | 23.5688495 | 258.346279 | 3379.0746 | 1415.1158 | 1305.7481 | 7279.312 | 3617.1119 | 24EA |
| 12 | 12 | 13 | 3.5 | 32.22310 | 13.93101 | 43.29634 | 21.85904 | 31.159851 | 10.3809739 | 151.53718 | 76.50664 | 20.8699069 | 23.138351 | 2019-10-26 19:00:00 | 2019-10-26 22:30:00 | 2019-10-27 05:34:56 | 2019-10-26 17:53:48 | 21.52444 | 48.03545 | 27.794245 | 168.12407 | 27.2363741 | 5.5407548 | 252.010060 | 775.6006 | 542.7817 | 562.5647 | 1331.474 | 704.7097 | 24EA |